{tpl head}
<script language="javascript">
    //获得选中文件的数据表
    function getCheckboxItem() {
        var myform = document.form1;
        var allSel = "";
        if (myform.bakfile.value)
            return myform.bakfile.value;
        for (i = 0; i < myform.bakfile.length; i++)
        {
            if (myform.bakfile[i].checked) {
                if (allSel == "")
                    allSel = myform.bakfile[i].value;
                else
                    allSel = allSel + "," + myform.bakfile[i].value;
            }
        }
        return allSel;
    }
    //反选
    function ReSel() {
        var myform = document.form1;
        for (i = 0; i < myform.bakfile.length; i++) {
            if (myform.bakfile[i].checked)
                myform.bakfile[i].checked = false;
            else
                myform.bakfile[i].checked = true;
        }
    }
    //全选
    function SelAll() {
        var myform = document.form1;
        for (i = 0; i < myform.bakfile.length; i++) {
            myform.bakfile[i].checked = true;
        }
    }
    //取消
    function NoneSel() {
        var myform = document.form1;
        for (i = 0; i < myform.bakfile.length; i++) {
            myform.bakfile[i].checked = false;
        }
    }
    //
    function checkSubmit()
    {
        var myform = document.form1;
        myform.bakfiles.value = getCheckboxItem();
        return true;
    }

</script>
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="new_table">
    <thead>
    <tr class="n_bt"><td colspan="8" align="center">管理系统</td></tr>
    <tr><th class="thbt" colspan="8">【{$title}】 <a href="?c=backup">数据备份</a></th></tr>
    </thead>
    <form name="form1" onSubmit="checkSubmit()" action="?c=backup&a=reduction_do" method="post" target="stafrm">
        <input type='hidden' name='dopost' value='redat' />
        <input type='hidden' name='bakfiles' value='' />
        <input type='hidden' name='folder' value='{$folder}' />
        <tr bgcolor="#F7F8ED">
            <td height="24" colspan="4" valign="top">
                <strong>发现的备份文件：</strong>
                <?php if(count($filelists)==0) echo " 没找到任何备份文件... "; ?>
            </td>
        </tr>
        <tr class="artlist" height='24'>
            {loop $filelists $k $v}
            {if $k%2==0 and $k>1}</tr><tr class="artlist">{/if}
            <td width='10%'><input name='bakfile' id='bakfile' type='checkbox' class='np' value='{$v}' checked='1' /></td>
            <td width='40%'>{$v}</td>
            {if count($filelists)%2!=0 and count($filelists)==($k+1)}<td></td><td></td>{/if}
            {/loop}
        </tr>
        <tr align="center" bgcolor="#FDFDEA">
            <td height="24" colspan="4">
                &nbsp;
                <input name="b1" class="button" type="button" id="b1" onClick="SelAll()" value="全选" />
                &nbsp;
                <input name="b2" class="button" type="button" id="b2" onClick="ReSel()" value="反选" />
                &nbsp;
                <input name="b3" class="button" type="button" id="b3" onClick="NoneSel()" value="取消" />
            </td>
        </tr>
        <tr bgcolor="#F7F8ED">
            <td height="24" colspan="4" valign="top">
                <strong>附加参数：</strong>
            </td>
        </tr>
        <tr  bgcolor="#FFFFFF">
            <td height="24" colspan="4">
                <input name="structfile" type="checkbox" class="np" id="structfile" value="{$structfile}" checked='1' />
                还原表结构信息(<?php echo $structfile?>)
                <input name="delfile" type="checkbox" class="np" id="delfile" value="1" />
                还原后删除备份文件 </td>
        </tr>
        <tr bgcolor="#E3F4BB">
            <td></td>
            <td height="33" colspan="4">&nbsp; <input type="submit" class="button" name="Submit" value="开始还原数据" class="coolbg np" /></td>
        </tr>
    </form>


    <tr bgcolor="#F7F8ED">
        <td height="24" colspan="4"><strong>进行状态： </strong></td>
    </tr>
    <tr bgcolor="#FFFFFF">
        <td height="180" style="height:180px;" colspan="4">
            <iframe name="stafrm" frameborder="0" id="stafrm" width="100%" height="100%"></iframe>
        </td>
    </tr>
</table>